package com.jsh.erp.remote;

import com.jsh.erp.datasource.entities.DepotHead;
import com.jsh.erp.service.depotHead.DepotHeadService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;

@RestController
@RequestMapping("/remote/api/depotHead")
public class DepotHeadApi {

    @Resource
    private DepotHeadService depotHeadService;

    @GetMapping("/getAccountSum")
    public BigDecimal getAccountSum(@RequestParam("id") Long id, @RequestParam("timeStr")  String timeStr, @RequestParam("type")  String type) throws Exception {
        return depotHeadService.getAccountSum(id, timeStr, type);
    }

    @GetMapping("/getManyAccountSum")
    public  BigDecimal getManyAccountSum(@RequestParam("id") Long id, @RequestParam("timeStr") String timeStr, @RequestParam("type") String type) throws Exception {
        return depotHeadService.getManyAccountSum(id, timeStr, type);
    }

    @GetMapping("/getDepotHeadListByAccountIds")
    public List<DepotHead> getDepotHeadListByAccountIds(@RequestParam("accountIds") String[] accountIds){
        return depotHeadService.getDepotHeadListByAccountIds(accountIds);
    }
}
